package cc.rengu.igas.momp.core.realize;

import cc.rengu.igas.momp.core.model.TransactionResource;

import java.util.List;

/**
 * 交易资源池接口定义
 *
 * @author Jinan Liu
 * @version 1.0.0
 * @date 2020/7/24 14:55
 */

public interface TransactionResourceService {

    /**
     * 向交易资源池PUSH单条记录接口定义
     *
     * @param transactionResource 营销模块交易资源实体类
     * @throws Exception 异常信息
     * @author Jinan Liu
     * @date 2020/7/24 16:39
     */
    void pushSingleRecordToResourcePool(TransactionResource transactionResource) throws Exception;

    /**
     * 从交易资源池POP单条记录接口定义
     *
     * @param transactionResource 营销模块交易资源实体类
     * @throws Exception 异常信息
     * @author Jinan Liu
     * @date 2020/7/24 16:39
     */
    void popSingleRecordFromResourcePool(TransactionResource transactionResource) throws Exception;

    /**
     * 查询交易资源池状态接口定义
     *
     * @param transactionResource 营销模块交易资源实体类
     * @return int 资源数量
     * @throws Exception 异常信息
     * @author Jinan Liu
     * @date 2020/7/25 11:07
     */
    int checkSingleTxnStatusFromResourcePool(TransactionResource transactionResource) throws Exception;

    /**
     * 清理已超时交易资源接口定义
     *
     * @param transactionResourceList 营销模块交易资源实体类
     * @throws Exception 异常信息
     * @author Jinan Liu
     * @date 2020/7/25 11:07
     */
    void purgeTimeoutTxnFromResourcePool(List<TransactionResource> transactionResourceList) throws Exception;
}
